/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package structure;

/**
 *
 * @author Gary Furlong
 */
public class State {
    private int number;
    private Variable variable;

    public State(Variable var, int n){
        variable = var;
        number = n;
    }

    public void setStateVariable(Variable v){
        variable = v;
    }

    public Variable getStateVariable(){
        return variable;
    }

    public void setStateNumber(int n){
        number = n;
    }

    public int getStateNumber(){
        return number;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 31 * hash + this.number;
        return hash;
    }

    @Override public boolean equals(Object s){
        State state = (State)s;
        if((state.getStateNumber()==number)&&(state.getStateVariable().getId()==variable.getId())){
            return true;
        }
        else return false;
    }

    @Override public String toString(){
        StringBuilder result = new StringBuilder();
        String NEW_LINE = System.getProperty("line.separator");

        result.append("State: " + number + " ");

        return result.toString();
    }
}
